# -*- encoding:utf-8 -*-
# !/usr/bin/env python
'''
    python-0803-01.py
    ======================
    @descript: 遍历
    @copyright:nnz
    @author:dln
    @date: 2021/8/3 10:45
    @version:v1.0
'''
#字符串
v_src='abc'
for v_key in v_src:
     print(v_key)
pass
#使用enumerate会增加第一个索引元素
# v_srv01=enumerate(v_src)
# print(list(v_srv01))
print('-'*50)
for v_src02 in enumerate(v_src):
    print(v_src02)
    pass
print('-'*50)
index=0
while index<len(v_src):
    print('{}={}'.format(index,v_src[index]))
    index+=1
    pass
#字节类型
print('-'*50)
v_bytes01=b'dhkrt'
for v_zijie in v_bytes01:
    print(chr(v_zijie))
    pass
print('-'*50)
for v_wz,v_zijie02 in enumerate(v_bytes01,start=1):  #start位置从1开始
    print('{}={}'.format(v_wz,chr(v_zijie02)))
    pass
#区间类型
v_range=range(1,8)
for v_key in v_range:
    print(v_key)
    pass
print('-'*50)
for  index,v_key in enumerate(v_range,start=0):
    print('{}={}'.format(index,v_key))
    pass
#字典   key_value
#遍历key值
print('-'*50)
v_dict01=dict(key01=10,key02=20,key03=30)
for v_key in v_dict01:
    print('{}={}'.format(v_key,v_dict01.get(v_key)))
    pass
print('-'*50)
for v_key in v_dict01:
    print('{}={}'.format(v_key,v_dict01.get(v_key)))
    pass
#变量.keys(),返回所有的key，所有的key都是集合类型
for v_key in v_dict01.keys():
    print('{}={}'.format(v_key,v_dict01.get(v_key)))
    pass
#遍历value
for v_value in v_dict01.values():
    print('{}={}'.format(v_value, v_dict01.get(v_value)))
    pass
#遍历key_value
for v_key,v_value in v_dict01.items():
    pass



